<?php
/**
 * Author:Arthur
 * Date:2013-2-20
 * File Name:receiveValidation_class.php
 * Email:kingarthurx@sina.cn
 */
class receiveValidation{
	/**
	 * 用户信息
	 */
 	private $user_id;
 	private $company_id;
 	private $department_id;
 	private $user_login_name;
 	private $user_login_password;
 	private $roleid;
 	private $user_real_name;
 	private $user_email;
 	private $user_phone;
 	private $user_mobile;
 	private $user_remark;
 	/**
 	 * 发送内容信息
 	 */
 	private $sms_record_id;
 	private $api_id;
 	private $sms_record_time;
 	private $sms_success_list;
 	private $sms_fail_list;
 	private $sms_success_count;
 	private $sms_fail_count;
 	private $sms_content;
 	private $sms_record_remark;
 	private $mobile;
 	private $content;
 	
 	/**
 	 * api信息
 	 */
 	private $userapi_id;
 	private $api_username;
 	private $api_password;
 	private $api_status;
 	private $sender_name;
 	private $sender_motivation;
 	private $api_type;
 	private $sender_status;
 	private $userapi_remark;
 	/**
 	 * info表信息
 	 */
 	 private $balance;
 	/**
 	 * 查询回复短信
 	 */
 	 private $msgcount;
 	 private $encodetype;
 	 	/*
 	 * 获取私有变量
 	 * */
 	 public function __get($allVariables){
 	 	if(isset($this->$allVariables)){
 	 		return $this->$allVariables;
 	 	}
 	 	else
 	 	{
 	 		return null;
 	 	}
 	 }
 	/*
 	 * 设置私有变量
 	 * */
 	 public function __set($allVariables,$value){
 	 	$this->$allVariables = $value;
 	 }
 	 
 	 /**
 	  * 查询用户是否存在，返回相应的信息
 	  */
 	 public function findUser(){
 	 	$sql="select * from zy_user where user_login_name = '$this->user_login_name'";
 	 	$arr = $GLOBALS['mysql']->selectId($sql);
 	 	return $arr;
 	 }
 	 /**
 	  * 查询用户及密码
 	  */
 	 public function findUserPassword(){
 	 	$sql="select * from zy_user where user_login_name = '$this->user_login_name' and user_login_password='$this->user_login_password'";
 	 	$arr = $GLOBALS['mysql']->selectId($sql);
 	 	return $arr;
 	 }
 	 /**
 	  * 查询该公司是否又API存在
 	  */
 	 public function findUserApi(){
 	 	$sql="select * from zy_userapi where company_id=$this->company_id";
 	 	$arr = $GLOBALS['mysql']->select($sql);
 	 	return $arr;
 	 }
 	 /**
 	  * 去除相应的短信条数
 	  */
 	 public function updateInfo($balances){
 	 	/*减去短讯条数，再更新*/
 	 	$balance =  $balances - $this->balance;
 	 	$alter_sql = "update zy_info set `balance` = '$balance' where company_id=".$this->company_id;
 	 	$GLOBALS['mysql']->upadte($alter_sql);
 	 }
 	 /**
 	  * 查询剩余短信
 	  */
 	 public function findInfo(){
 	 	$sql="select balance from zy_info where company_id=".$this->company_id;
 	 	$arr = $GLOBALS['mysql']->selectId($sql);
 	 	return $arr;
 	 }
 	 /**
 	  * 查询回复短信
 	  */
 	 public function getReply(){
 	 	$sql="select * from zy_sms_reply where company_id=$this->company_id LIMIT 0,$this->msgcount";
 	 	$arr = $GLOBALS['mysql']->select($sql);
 	 	return $arr;
 	 }
 }